﻿using System;
using MoonSharp.Interpreter;
using UnityEngine;

namespace Lua
{
	// Token: 0x020002E8 RID: 744
	[MoonSharpUserData]
	public class AI
	{
		// Token: 0x06001138 RID: 4408 RVA: 0x0007F317 File Offset: 0x0007D517
		[MoonSharpHidden]
		public AI(EntityBase entity)
		{
			if (entity == null)
			{
				Debug.LogError("Creating AI with no entity");
			}
			this.entity = entity;
		}

		// Token: 0x06001139 RID: 4409 RVA: 0x0007F33C File Offset: 0x0007D53C
		public void StopAction()
		{
			this.entity.actionManager.ClearAll();
		}

		// Token: 0x0600113A RID: 4410 RVA: 0x0007F34E File Offset: 0x0007D54E
		public void CancelQueuedActions()
		{
			this.entity.actionManager.ClearQueue();
		}

		// Token: 0x0600113B RID: 4411 RVA: 0x0007F360 File Offset: 0x0007D560
		public void CancelQueuedBehaviors()
		{
			this.entity.ai.behaviorController.ClearQueue();
		}

		// Token: 0x0600113C RID: 4412 RVA: 0x0007F377 File Offset: 0x0007D577
		public bool HasQueuedActions()
		{
			return !this.entity.actionManager.IsQueueEmpty();
		}

		// Token: 0x0600113D RID: 4413 RVA: 0x0007F38C File Offset: 0x0007D58C
		public bool HasQueuedBehaviors()
		{
			return !this.entity.ai.behaviorController.IsQueueEmpty();
		}

		// Token: 0x0600113E RID: 4414 RVA: 0x0007F3A6 File Offset: 0x0007D5A6
		public bool IsActionActive()
		{
			return !this.entity.actionManager.IsIdle();
		}

		// Token: 0x0600113F RID: 4415 RVA: 0x0007F3BB File Offset: 0x0007D5BB
		public bool IsBehaviorActive()
		{
			return !this.entity.ai.behaviorController.IsIdle();
		}

		// Token: 0x06001140 RID: 4416 RVA: 0x0007F3D5 File Offset: 0x0007D5D5
		public void StopBehavior()
		{
			if (this.entity.ai.behaviorController.HasMainBehavior())
			{
				Debug.Log("StopBehavior: No main behavior to stop");
			}
			else
			{
				this.entity.ai.behaviorController.StopMainBehavior();
			}
		}

		// Token: 0x06001141 RID: 4417 RVA: 0x0007F415 File Offset: 0x0007D615
		public void StopSecondaryBehavior(string flag)
		{
			this.entity.ai.behaviorController.StopSecondaryBehavior(flag);
		}

		// Token: 0x06001142 RID: 4418 RVA: 0x0007F42D File Offset: 0x0007D62D
		public void DisableAI()
		{
			this.entity.ai.DisableAI();
		}

		// Token: 0x06001143 RID: 4419 RVA: 0x0007F43F File Offset: 0x0007D63F
		public void EnableAI()
		{
			this.entity.ai.EnableAI();
		}

		// Token: 0x06001144 RID: 4420 RVA: 0x0007F451 File Offset: 0x0007D651
		public bool IsAIEnabled()
		{
			return this.entity.ai.IsEnabled();
		}

		// Token: 0x06001145 RID: 4421 RVA: 0x0007F463 File Offset: 0x0007D663
		public void SetBehavior(string name)
		{
			this.entity.ai.behaviorController.SetBehaviorByName(name, null, Vector3.zero);
		}

		// Token: 0x06001146 RID: 4422 RVA: 0x0007F481 File Offset: 0x0007D681
		public void SetBehavior(string name, Entity target)
		{
			this.entity.ai.behaviorController.SetBehaviorByName(name, target.entity, Vector3.zero);
		}

		// Token: 0x06001147 RID: 4423 RVA: 0x0007F4A4 File Offset: 0x0007D6A4
		public void SetBehavior(string name, Vector3 position)
		{
			this.entity.ai.behaviorController.SetBehaviorByName(name, null, position.vector3);
		}

		// Token: 0x06001148 RID: 4424 RVA: 0x0007F4C3 File Offset: 0x0007D6C3
		public void QueueBehavior(string name)
		{
			this.entity.ai.behaviorController.QueueBehaviorByName(name, null, Vector3.zero);
		}

		// Token: 0x06001149 RID: 4425 RVA: 0x0007F4E1 File Offset: 0x0007D6E1
		public void QueueBehavior(string name, Entity target)
		{
			this.entity.ai.behaviorController.QueueBehaviorByName(name, target.entity, Vector3.zero);
		}

		// Token: 0x0600114A RID: 4426 RVA: 0x0007F504 File Offset: 0x0007D704
		public void QueueBehavior(string name, Vector3 position)
		{
			this.entity.ai.behaviorController.QueueBehaviorByName(name, null, position.vector3);
		}

		// Token: 0x040016B1 RID: 5809
		private EntityBase entity;
	}
}
